//
//  ViewController.swift
//  SwitfTest
//
//  Created by runone02 on 2018/12/27.
//  Copyright © 2018年 liqiyun. All rights reserved.
//

import UIKit


class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = RGBAlpa(222,222,222,1)
        self.title = "视图"

        addButton()

    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
   
    
    func addButton(){
        let tebutton: UIButton = UIButton(type:.custom)
        tebutton.setTitle("按钮",for:.normal)
        tebutton.backgroundColor = UIColor.black
        tebutton.titleLabel?.font = UIFont.boldSystemFont(ofSize: 15)
        //设置圆角
        tebutton.layer.cornerRadius = 5
        tebutton.layer.borderWidth = 1
        tebutton.layer.masksToBounds = true
        tebutton.layer.borderColor = UIColor.blue.cgColor
        //设置阴影
        //        tebutton.layer.shadowColor = UIColor.black.cgColor
        //        tebutton.layer.shadowOpacity = 1.0
        //        tebutton.layer.shadowOffset = CGSize(width: 0, height: 0)
        //        tebutton.layer.shadowRadius = 4
        
        tebutton.addTarget(self,action:#selector(tapped),for:.touchUpInside)
        //        tebutton.adjustsImageWhenHighlighted = false //使触摸模式下按钮也不会变暗
        //        tebutton.adjustsImageWhenDisabled = false //使禁用模式下按钮也不会变暗
        
        tebutton.setImage(UIImage(named: "leftbackicon_sdk_login"), for: .normal)
        view.addSubview(tebutton)
        

        tebutton.mas_makeConstraints { (make) in
            make?.left.offset()(20)
            make?.top.offset()(80)
            make?.width.mas_equalTo()(60)
            make?.height.mas_equalTo()(60)
            
        }
    }
    

    @objc func tapped(){
//        let testView = TestView()
//        self.view.addSubview(testView)
//        testView.mas_makeConstraints { (make) in
//            make?.top.mas_equalTo()(self.view)
//            make?.left.mas_equalTo()(self.view)
//            make?.right.mas_equalTo()(self.view)
//            make?.bottom.mas_equalTo()(self.view)
//        }

    }
    
}

